package com.ysd.lis.controller.eq;


import com.ysd.common.Result;
import com.ysd.lis.controller.pub.BaseController;
import com.ysd.lis.entity.eq.EqPatrolTask;
import com.ysd.lis.entity.eq.EqSpotcheckTask;
import com.ysd.lis.request.CommonPageDto;
import com.ysd.lis.service.eq.EqSpotcheckTaskService;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * <p>
 * 设备点检记录 前端控制器
 * </p>
 *
 * @author WH
 * @since 2024-08-26
 */
@RestController
@RequestMapping("/api/eq/spotcheckTask")
public class EqSpotcheckTaskController extends BaseController {

    @Autowired
    private EqSpotcheckTaskService eqSpotcheckTaskService;
    @ApiOperation("分页查询")
    @GetMapping("/findSpotcheckTaskPageList")
    public Result findSpotcheckTaskPageList(CommonPageDto pageParam) {
        return eqSpotcheckTaskService.findSpotcheckTaskPageList(pageParam);
    }

    @ApiOperation("新增巡检任务")
    @PostMapping("/addSpotcheckTask")
    public Result addSpotcheckTask(@RequestBody EqSpotcheckTask eqSpotcheckTask) {
        return eqSpotcheckTaskService.addSpotcheckTask(eqSpotcheckTask);
    }
    @ApiOperation("编辑巡检任务")
    @PostMapping("/editSpotcheckTask")
    public Result editSpotcheckTask(@RequestBody EqSpotcheckTask eqPatrolTask) {
        return eqSpotcheckTaskService.editSpotcheckTask(eqPatrolTask);
    }
    @ApiOperation("查询点检任务")
    @GetMapping("/findSpotcheckTaskById")
    public Result findSpotcheckTaskById(EqSpotcheckTask eqSpotcheckTask) {
        return eqSpotcheckTaskService.findSpotcheckTaskById(eqSpotcheckTask);
    }
    @ApiOperation("查询点检任务通过计划id")
    @GetMapping("/findSpotcheckTaskByPlanId")
    public Result findSpotcheckTaskByPlanId(EqSpotcheckTask eqSpotcheckTask) {
        return eqSpotcheckTaskService.findSpotcheckTaskByPlanId(eqSpotcheckTask);
    }

    @ApiOperation("批量删除点检任务")
    @PostMapping("/deleteSpotcheckTask")
    public Result deleteSpocheckTask(@RequestBody List<EqSpotcheckTask> eqSpotcheckTasks) {
        return eqSpotcheckTaskService.deleteSpotcheckTask(eqSpotcheckTasks);
    }

}
